home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 4 / Amiga Tools 4.iso / tools / mail-tools / thor / thor_2.22 / thor.lha / rexx / BatchFTP.thor < prev    next >
Text File  |  1995-12-18  |  1KB  |  73 lines

  1. /*
  2. **
  3. ** BatchFTP.thor  - Will create a file suitable for DaFTP processing.
  4. **                    This scripts assumes that there is only one file
  5. **                    matching the filename in the database.
  6. */
  7.  
  8. outfile = "ram:FTP"        /* Edit at will */
  9. system = "News&Mail"    /* Edit to the name of your Internet system in THOR */
  10.  
  11. FDF_DELETED = '00000001'x
  12.  
  13. options results
  14.  
  15. thorport = address()
  16.  
  17. if ~show('p', 'BBSREAD') then do
  18.     address command
  19.         "run >nil: `GetEnv THOR/THORPath`bin/LoadBBSRead"
  20.         "WaitForPort BBSREAD"
  21. end
  22.  
  23. address(thorport)
  24.  
  25. GETFILELIST outstem LIST
  26. if(rc ~= 0) then
  27. do
  28.     if(rc = 5) then REQUESTNOTIFY TEXT '"Window not open."' BT '"_Ok"'
  29.     if(rc = 6) then REQUESTNOTIFY TEXT '"No files selected."' BT '"_Ok"'
  30.     if(rc = 30) then REQUESTNOTIFY TEXT '"'THOR.LASTERROR'"' BT '"_Ok"'
  31.     exit
  32. end
  33.  
  34. outline = "mget"
  35.  
  36. do i=1 to LIST.COUNT
  37.  
  38.     drop FILE.    /* Important */
  39.  
  40.     address (bbsread)
  41.     SEARCHBRFILE '"'system'"' FILE SEARCH '"'LIST.FILENAME.i'"' NAME
  42.     if(rc ~= 0) then 
  43.     do
  44.         say BBSREAD.LASTERROR
  45.         exit
  46.     end
  47.  
  48.     if(FILE.FILEAREA.COUNT ~= 0) then
  49.     do
  50.         drop FTAGS.
  51.         drop FDATA.
  52.  
  53.         READBRFILE '"'system'"' '"'FILE.FILEAREA.1'"' filenr LIST.FILENR.i tagsstem FTAGS datastem FDATA
  54.         if(rc ~= 0) then 
  55.         do
  56.             say BBSREAD.LASTERROR
  57.             exit
  58.         end
  59.         if (bitand(DATA.FLAGS,FDF_DELETED) ~= FDF_DELETED) then
  60.             outline = outline || ' ' || FILE.FILEAREA.1 || '/' || FTAGS.NAME
  61.     end
  62. end
  63.  
  64. if(open(fh, outfile, W)) then
  65. do
  66.     if(outline ~= "mget") then
  67.         call writeln(fh, outline)
  68.  
  69.     call close(fh)
  70. end
  71.  
  72. exit
  73.